#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 
# Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
# 

"""
File: run8.py
Author: zhangyang(zhangyang40@baidu.com)
Date: 2018/1/5 0005 12:49
"""
"""
给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。
"""


class Solution:
    def Power(self, base, exponent):
        flag = 0
        if base == 0:
            return False
        if exponent == 0:
            return 1
        if exponent < 0:
            flag = 1
        result = 1
        for i in range(abs(exponent)):
            result *= base
        if flag == 1:
            result = 1 / result
        return result
